package com.javasm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author：javasm
 * @Version：1.0
 * @Date：2023/11/3-11:32
 * @Since：jdk1.8
 * @Description：
 */
@RestController
public class SendEmailController {


    @Autowired
    private JavaMailSender javaMailSender;

    @GetMapping("getEmailCode")
    public String getEmailCode(String email){


        SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
        simpleMailMessage.setFrom("清华大学<13797512515@163.com>");

        simpleMailMessage.setSubject("验证码");

        simpleMailMessage.setText("666666");

        simpleMailMessage.setTo("1276503451@qq.com");

        // 发送邮件
        javaMailSender.send(simpleMailMessage);



        return "ok";
    }
}
